var express = require('express');
var router = express.Router();

const warehousezone = require("../controller/warehousezone");
const auth = require("../controller/auth");

//守卫路由：所有路由必须执行权限控制的判断
router.all("*", auth.isLogin, auth.isAdmin);
//通过仓库区域名字（模糊查询）所含货架列表
router.get("/shelvesByZoneName", warehousezone.findShelvesByZoneName);
//获取最少货架的仓库区域信息
router.get("/minShelves", warehousezone.findMinShelves);
//通过名字模糊查询仓库区域
router.get("/name", warehousezone.findByKeyword);
//获取仓库区域列表
router.get("/list", warehousezone.findAll);
//修改仓库区域
router.patch("/:id", warehousezone.update);
//通过指定id查询
router.get("/:id", warehousezone.find);
//删除指定仓库区域
router.delete("/:id", warehousezone.remove);
//通过类型模糊查询仓库区域
router.get("/", warehousezone.findByZoneTypeLike);

//增加
router.post("/", warehousezone.add);
//获取仓库总数
router.get("/count", warehousezone.getCount);



module.exports = router;